package www.reviewW.view;

import www.reviewW.data.Knowledge;
import www.reviewW.data.ModeData;
import www.reviewW.data.ReviewWData;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class KnowledgeFuxi { //知识点添加类，此类将添加一条新的知识
    JLabel title = new JLabel("知识点标题");
    JLabel content = new JLabel("知识点描述");
    JTextField titleTextField = new JTextField(); //标题文本档
    JTextArea contentTextArea = new JTextArea();
    JButton jButton2 = new JButton("返回");
    public KnowledgeFuxi(JFrame jFrame, Knowledge knowledge){
        titleTextField.setText(knowledge.getTitle());
        contentTextArea.setText(knowledge.getContent());
        JDialog jDialog = new JDialog(jFrame,true);
        jDialog.setTitle("测试一下掌握程度吧");
        jDialog.setSize(500,400);
        jDialog.setLocationRelativeTo(null);
        jDialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        jDialog.setLayout(null);

        title.setBounds(new Rectangle(30,0,100,30));
        titleTextField.setBounds(new Rectangle(title.getWidth(),title.getY(),350,title.getHeight()));

        content.setBounds(new Rectangle(title.getX(),title.getHeight(),title.getWidth(),title.getHeight()));
        JScrollPane js = new JScrollPane(contentTextArea);


        js.setBounds(new Rectangle(titleTextField.getX(),content.getY()+15,titleTextField.getWidth(),250));


        jButton2.setBounds(new Rectangle(100,320,100,30));

        jButton2.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                jDialog.dispose();
            }
        });

        jDialog.add(title);
        jDialog.add(titleTextField);

        jDialog.add(content);
        jDialog.add(js);

        jDialog.add(jButton2);




        jDialog.setVisible(true);
    }
    public static void main(String[] args){
    }
}
